Allow creating slugs for emoji characters.#129
Allow creating slugs for emoji characters.#129jekyllbot merged 7 commits intojekyll:masterfrom xlgmokha:patch-1
Conversation
|
I'd like this to be a "configurable" option instead of forcing jekyll-archives:
slug_mode: pretty # Modes supported by your Jekyll version.
# default: `nil` |
|
I updated the PR to read in the |
|
@mokhan Could you state the problem you're trying to solve here? What is the primary use case? |
|
I apologise for not clearly stating my problem. I updated the description. I hope this helps. |
```irb irb(main):002:0> x = "💎" => "💎" irb(main):003:0> Jekyll::Utils.slugify(x) => "" irb(main):004:0> Jekyll::Utils.slugify(x, mode: nil) => "" irb(main):005:0> Jekyll::Utils.slugify(x, mode: :pretty) => "💎" ```
|
It might also be useful for slugify to raise a pretty loud warning if the input was not an empty string but the output is. |
@pathawks Would that be something for Jekyll Core to do instead..? |
ashmaroli
left a comment
There was a problem hiding this comment.
👍 from me. Just a minor question regarding a test..
Yes. Sorry, I was assuming this was a Jekyll Core issue. |
|
@mokhan Sorry for the delay with this. The acceptable slugify modes have always been strings: SLUGIFY_MODES = %w(raw default pretty ascii latin).freezeAnd your implementation here presumably works in the tests because def slugify(string, mode: nil, cased: false)
mode ||= "default"
return nil if string.nil?
unless SLUGIFY_MODES.include?(mode)
return cased ? string : string.downcase
end
...
endTherefore, I'll keep this PR open for a week more for you to revisit. (You are free to close this voluntarily, if you don't want to pursue this any more). |
Yes. This is still a problem: If people want to generate a unique slug, this MR allows them to inject a custom slug mode.
Agreed. I can remove the call to |
|
Back to you @ashmaroli. 🏓 |
|
Thank you @mokhan |
I would like to be able to generate archives for categories identified by an emoji character.
For example:
https://www.mokhan.ca/ls/💎/
The current version of this gem replaces the emoji character with a blank string:
This behaviour causes the generation of archives in the root of the
categorypermalink. i.e/:category/instead of/:category/💎/.My proposed solution adds a new configuration named
slug_modethat allows jekyll users to change how slugs are generated. The:rawslug mode preserves the emoji character instead of replacing it with a blank string.